﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using System.Data.SqlClient;
using Microsoft.Reporting.WinForms;

namespace AppAcc.Views.BaoCaoChungTu
{
    public partial class FormBaoCaoNhapXuatTon : Form
    {
        private string SoTK1;
        // private string SoTK;
        private DateTime d1, d2;
        public FormBaoCaoNhapXuatTon()
        {
            InitializeComponent();
        }
        public FormBaoCaoNhapXuatTon(string TK1, DateTime dt1, DateTime dt2)
        {
            InitializeComponent();
            SoTK1 = TK1.Trim();
            d1 = dt1;
            d2 = dt2;
        }

        private void FormBaoCaoNhapXuatTon_Load(object sender, EventArgs e)
        {
            try
            {
                this.pr_BaoCaoTongHopNhapXuatTableAdapter.Fill(this.dS_BaoCaoNhapXuatTon.pr_BaoCaoTongHopNhapXuat, SoTK1,
                    d1, d2);
                ReportParameter[] rptParams = new ReportParameter[]
            {
                new ReportParameter("SoTK",SoTK1), 
                new ReportParameter("TuNgay",Convert.ToString(d1)),
                new ReportParameter("DenNgay",Convert.ToString(d2)),
            };
                reportViewer1.LocalReport.SetParameters(rptParams);
                this.reportViewer1.RefreshReport();
            }
            catch (Exception)
            {
                this.pr_BaoCaoTongHopNhapXuatTableAdapter.Fill(this.dS_BaoCaoNhapXuatTon.pr_BaoCaoTongHopNhapXuat, SoTK1,
                  d1, d2);
                ReportParameter[] rptParams = new ReportParameter[]
            {
                new ReportParameter("SoTK",SoTK1), 
                new ReportParameter("TuNgay",Convert.ToString(d1)),
                new ReportParameter("DenNgay",Convert.ToString(d2)),
            };
                reportViewer1.LocalReport.SetParameters(rptParams);
                this.reportViewer1.RefreshReport();
              //  throw;
            }
           
        }
    }
}
